<table class="common-table">
	<thead>
		<tr>
			<th>ID</th>
			<th>图片</th>
			<th>名称</th>
			<th>描述</th>
			<th>更新时间</th>
			<th>更新者</th>
			<th style="width:40px;">状态</th>
			<th style="width:40px;">操作</th>
			<th style="width:40px;"></th>
		</tr>
	</thead>
	<tbody>
		#{if brands}
			#{list items:brands, as:'brand'}
			<tr>
				<th><a href="/admin/brand/view/${brand.id}">${brand.id}</a></th>
				<td>
					<a href="/admin/brand/view/${brand.id}">
						#{if brand.image}
						<img class="midImg_brand" src="@{Attachments.show(brand.image.id)}">
						#{/if}
						#{else}
						<img class="midImg_brand" src="@{'public/images/favicon.png'}">
						#{/else}
					</a>
				</td>
				<td><a href="/admin/brand/view/${brand.id}">${brand.name}</a></td>
				<td>${brand.common}</td>
				<td>${brand.lastModifiedAt.format("yyyy-MM-dd hh:mm")}</td>
				<td>
					#{if brand.lastModifiedByAdmin}
					${brand.lastModifiedByAdmin.username}
					#{/if}
				</td>
				<td>
					#{if brand.status == models.BaseEntity.Status.ENABLE}
					<font class="important_2">可用</font>
					#{/if}
					#{if brand.status == models.BaseEntity.Status.DISABLED}
					<font class="important_1">不可用</font>
					#{/if}
				</td>
				<td>
					<a href="/admin/brand/view/${brand.id}" class="editer">
					[编辑]
					</a>
				</td>
				<td>
					#{if brand.status == models.BaseEntity.Status.ENABLE}
					<a href="javascript:updateBrandStatus(${brand.id}, 'DISABLED')" class="important_1">
					[禁用]
					</a>
					#{/if}
					#{if brand.status == models.BaseEntity.Status.DISABLED}
					<a href="javascript:updateBrandStatus(${brand.id}, 'ENABLE')" class="important_2">
					[启用]
					</a>
					#{/if}
				</td>
			</tr>
			#{/list}
		#{/if}
		#{else}
		<tr>
			<td colspan="13">没找到结果。</td>
		</tr>
		#{/else}
	</tbody>
</table>
<div id="pager" style="font-size:1.3em;"></div>
<script language="javascript">
//初始化翻页控件。
function initialPager() {
	$("#pager").pager(
		{
			pagenumber: ${queryBean.currentPage}, 
			pagecount: ${queryBean.totalPage}, 
			totalcount: ${queryBean.totalQuantity},
			buttonClickCallback: PageClick
		}
	);
}
//翻页功能。
function PageClick(pageclickednumber) {
	$("#currentPage").val(pageclickednumber);
	reloadTable();
}
</script>